﻿#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

typedef double Real;

Real f(Real x)
{
	if (x == 10)
		return 1 / x;
	return x;
}

typedef struct TContext_s
{
	Real x;
	int n;
	int m;
	int a;
	int b;
	char c;
	int v[100];
}TContext;

TContext context;

void read_data(TContext* ctx)
{
	scanf("%d %d %c", &ctx->a, &ctx->b, &ctx->c);
}

void do_task(TContext* ctx)
{
	Real cost = 0;
	switch (ctx->b)
	{
	case 90:
		cost = 6.95;
		break;
	case 93:
		cost = 7.44;
		break;
	case 97:
		cost = 7.93;
		break;
	}
	cost *= ctx->a;
	switch (ctx->c) {
	case 'm':
		cost *= 0.95;
		break;
	case 'e':
		cost *= 0.97;
		break;
	}
	printf("%.2f", cost);
}

void solve(TContext* ctx)
{
	read_data(ctx);
	do_task(ctx);
}

int main()
{
	freopen("D:/Develop/GitRepos/MOOC/浙江大学/数据结构/201906/DataStructure/M2019秋C入门和进阶练习集/7-115.txt", "r", stdin);
	solve(&context);
	return 0;
}
